#include "StompedReality/Core/Graphics/RenderSystem.h"
#include "StompedReality/Core/OS/SystemMessageProcessor.h"
#include "StomperLib/Editor.h"
#include "StomperLib/EditorTasks.h"
#include "StomperLib/Gwen/GwenInputBinding.h"
#include <Gwen/Skins/Simple.h>
#include <Gwen/Skins/TexturedBase.h>
#include <assert.h>
namespace StomperLib {
Editor::Editor( )
{
}

Editor::~Editor( )
{
}

bool Editor::ParseConfig( const char* fileName )
{
  bool ok = Game::ParseConfig( fileName );
  this->m_GwenRenderer = new StomperLib::GwenBinding::GwenRenderer( );
  this->m_GwenRenderer->SetGame( this );
  Gwen::Skin::TexturedBase* gSkin = new Gwen::Skin::TexturedBase( this->m_GwenRenderer );
  gSkin->Init( "EditorBase/DesignerSkin.png" );

  //Gwen::Skin::Simple *gSkin = new Gwen::Skin::Simple(m_GwenRenderer);
  this->m_Skin = gSkin;
  this->m_Canvas = new Gwen::Controls::Canvas( this->m_Skin );
  this->m_Canvas->SetSize( this->m_RenderSystem->GetWidth( ), this->m_RenderSystem->GetHeight( ) );

  //this->m_Canvas->SetBackgroundColor(Gwen::Color(255,0,0,0));
  this->m_Canvas->SetDrawBackground( false );
  this->m_GwenInput = new StomperLib::GwenBinding::GwenInputBinding( );
  this->m_GwenInput->Initialize( this->m_Canvas );
  this->getSysMsgProcessor( )->AddListener( this->m_GwenInput );
  return ok;
}

Gwen::Controls::Canvas* Editor::getCanvas( )
{
  return this->m_Canvas;
}

StomperLib::GwenBinding::GwenInputBinding* Editor::getInputBinding( )
{
  return this->m_GwenInput;
}

}
